Why do we need Web-Api? [closed]

Posted by user437973 on Stack Overflow See other posts from Stack Overflow or by user437973
Published on 2012-06-24T12:55:22Z Indexed on 2012/06/25 3:16 UTC
Read the original article Hit count: 161

I was just wondering what the deal is with Asp.net Web-Api. Why did we need a separate type of controller in order to facilitate varying content types for action results? Why wasn't this capability just baked into the ASP.Net MVC base controller?

Anyway, I was just wondering if there was a compelling reason to use both types of controllers within the same project, assuming that the project was being freshly created, or if this project structure was due to an inherent technical limitation. Would it be possible to have ApiControllers fulfill the purpose of an MVC Controller in all cases by just serving HTML when that is the specified accept type?

It just seems to me like a lot of unnecessary repetition to have to re-implement the same types of actions using both types of controllers if you want those actions to be available to your web application through the API and through the web interface.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about asp.net-web-api